---
title: "The Political Effects of Witnessing State Atrocities: Evidence from the Nazi Death Marches<br><br>Replication instructions<br>"
author: "Alexander De Juan, Christian Gläßel, Felix Haass, Adam Scharpf"
format:
  html:
    theme: cosmo
    toc: true
    toc-location: left
    code-fold: false
    code-summary: "Show the code"
    embed-resources: true

editor: source
execute: 
  warning: false
  message: false
---


# Download

To replicate the tables and figures in the main text and in the appendix make sure that you download the entire replication archive from the Dataverse and unzip it into one folder. 


# Folder structure


The replication archive contains the following folders:

- `./code/`: Contains all the scripts necessary to replicate figures and tables in the paper and appendix. 
- `./data/`: Contains all the data files necessary for the scripts in `./code/` to run.  
- `./figures/`: All the plots produced by the scripts in `./code/` will be saved here.
- `./tables/`: All the tables produced by the scripts in `./code/` will be saved here.

In addition, the archive folder contains the following files:

- `README.qmd` & `README.html`: This file and the Quarto script to generate this file.
- `replication_materials_death_marches.rproj`: The R project file that needs to be run first to run the replication scripts.


# Replication

## R scripts

To replicate figures and tables generated in R, follow these steps:

1. **Important:** Open the file `replication_materials_death_marches.rproj` in RStudio first. This step is necessary to set all the correct file paths in the other R scripts. 
2. From within RStudio, open the R script `main_replication_script.R` in the `/code/` folder.
3. Run the script, e.g. by pressing the `source` button in RStudio.
4. Results will be stored in `/figures/` or `/tables/` with the table/figure name that corresponds to the table/figure name in the paper and supplementary information. 


## Stata `.do` files

Figure 1, Table 2, Table SI-7.1, Table SI-7.2, and Table SI-7.3 are generated in Stata. To replicate those, open the `figure_1_replication_script.do` file and the `indlevel_replication_script.do` file in the `/code/` folder. Importantly, you need to insert the correct file path to the main replication archive (the folder where the `replication_materials_death_marches.rproj` is located) in the global macro /PATH/

Run the `.do` files and results log file/figures will be produced in the respective subfolders.



# Software versions and packages

## R version & packages

The following packages are required to run the R scripts. You can copy and paste the commands below in your R console to automatically install or update them. 

```{r, eval=FALSE}

install.packages("tidyverse")
install.packages("fixest")
install.packages("sf")
install.packages("here")
install.packages("broom")
install.packages("fixest")
install.packages("modelsummary")
install.packages("gt")
install.packages("kableExtra")
install.packages("patchwork")
install.packages("haven")
install.packages("rmapshaper")
install.packages("lubridate")
install.packages("patchwork")
install.pacakges("gridExtra")



```

We use the following R software and package versions:

```{r, echo=FALSE, message=FALSE, warning=FALSE}

library(tidyverse)
library(fixest)
library(sf)
library(here)
library(broom)
library(fixest)
library(modelsummary)
library(gt)
library(kableExtra)
library(patchwork)
library(haven)
library(rmapshaper)
library(lubridate)
library(patchwork)
library(gridExtra)

sessionInfo()
```


## Stata version

All analyses were performed in Stata 16 



